<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <form id="login">
    <input type="text" name="username" />
    <input type="text" name="password" />

    <button type="submit">提交</button>
  </form>

  <script src="./lib/jquery.js"></script>
  <script>
    // $('#login').submit(function(e) {
    //   console.log(222, $(this).serialize())
    //   e.preventDefault()  // 阻止默认行为
    // })

    $('#login').on('submit', function(e) {
      console.log(111, $(this).serialize())
      e.preventDefault()
    })
  </script>
</body>
</html>